package cn.tedu.submarine;

import javax.swing.*;
import java.awt.event.KeyEvent;

//战舰类
public class Battleship extends SeaObject{
    private int life;


    /** 构造方法*/
    public Battleship(){
        super(66,26,270,124,20);
        life = 5;
    }


    public void step(){
    }


    public ImageIcon getImage(){
       return Images.battleship;
    }
    public ImageIcon getImage(int x,int y){return Images.bomb;}



/*    Bomb[] aaa = new Bomb[]{
            new Bomb(this.x,this.y),
            //new Bomb(this.x+10,this.y),
            //new Bomb(this.x-10,this.y)
    };*/


    public Bomb[] shootBomb(){
        Bomb[] aaa = new Bomb[]{
                new Bomb(this.x+33,this.y),
                new Bomb(this.x+33,this.y),
                new Bomb(this.x+33,this.y)
        };
        return  aaa;
      // return new Bomb(this.x,this.y);
    }

    public void moveRight(){
        if(x<= World.WIDTH-this.width)
        x+=speed;
    }
    public void moveLeft(){
        if(x>=0){
            x-=speed;
        }
    }
    public void moveUp(){
        if(y>=0){
            y-=speed;
        }
    }
    public void moveDown(){
        if(y<= 135-this.height)
        y+=speed;}

    public void addLife(int life){
        this.life+=life;
    }
    public void subtractLife(){
        life--;
    }

    public int getLife(){
        return life;
    }
}


























